package org.lites.dcimmodifier;

import android.content.Context;
import android.widget.Toast;

/**
 * Toast工具类,简化Toast的使用
 */
public class ToastUtils {
    private static Toast toast;

    public static void showShort(Context sContext, CharSequence sequence) {
        if (toast == null) {
            toast = Toast.makeText(sContext, sequence, Toast.LENGTH_SHORT);

        } else {
            toast.cancel();
            toast = Toast.makeText(sContext, sequence, Toast.LENGTH_SHORT);
            toast.setDuration(Toast.LENGTH_SHORT);

        }
        toast.show();
    }
    public static void showLong(Context sContext,CharSequence sequence) {
        if (toast == null) {
            toast = Toast.makeText(sContext, sequence, Toast.LENGTH_LONG);

        } else {
            toast.cancel();
            toast = Toast.makeText(sContext, sequence, Toast.LENGTH_LONG);
            toast.setDuration(Toast.LENGTH_LONG);
        }
        toast.show();
    }

}
